using System;
using System.Data;
using System.Collections.Generic;
using System.Data.SqlClient;
using Core;
using log4net;

namespace DataAccess
{
    public class tbPosts_Proxy
    {
        ILog log = LogManager.GetLogger(typeof(DataAccess.tbPosts).Name);
        Popular cur = new tbPosts();
        public bool Insert_tbPosts_Proxy(Popular cn)
        {
            bool kq = true;
            try
            {
                kq = cur.Insert(cn);
            }
            catch (Exception)
            {
                kq = false;
            }
            if (kq)
                log.Info(" form tbPosts insert success");
            else
                log.Info("form tbPosts insert fail");
            return kq;
        }
        public bool Update_tbPosts_Proxy(Popular cn)
        {
            bool kq = true;
            try
            {
                kq = cur.Update(cn);
            }
            catch (Exception) { kq = false; }
            if (kq)
                log.Info(" form tbPosts update success");
            else
                log.Info("form tbPosts update fail");
            return kq;
        }
        public bool Delete_tbPosts_Proxy(object b)
        {
            bool kq = true;
            try
            {
                kq = cur.Delete(b);
            }
            catch (Exception) { kq = false; }
            if (kq)
                log.Info(" form tbPosts delete success");
            else
                log.Info("form tbPosts delete fail");
            return kq;
        }
        public IDataReader GetById_tbPosts_Proxy(object b)
        {
            log.Info(" form tbPosts Search by Id");
            try { return cur.Select_ID(b); }
            catch (Exception) { throw; }
        }
        public IDataReader GetByName_tbPosts_Proxy(object b)
        {
            log.Info(" form tbPosts Search by Name");
            return cur.Select_Name(b);
        }
        public IDataReader SelectNo_tbPosts_Proxy(object b)
        {
            log.Info(" form tbPosts Search ");
            if (ConvertType.ToInt(b) != 0)
                return cur.Select_ID(b);
            return cur.Select_Name(b);
        }
        public IDataReader SelectAll_tbPosts_Proxy()
        {
            log.Info(" form tbPosts Load data");
            try { return cur.SelectAll(); }
            catch (Exception) { throw; }
        }

        public List<tbPosts> SelectNews()
        {
            return new tbPosts().SelectNews();
        }
        public List<tbPosts> SelectAllByOrg(int orgid)
        {
            return new tbPosts().SelectAllByOrg(orgid);
        }
        public List<tbPosts> SelectNewsByOrg(int orgid)
        {
            return new tbPosts().SelectNewsByOrg(orgid);
        }
        public List<tbPosts> SelectNewsByOrgCategory(int orgid, int categoryid)
        {
            return new tbPosts().SelectNewsByOrgCategory(orgid,categoryid);
        }
        public List<tbPosts> SelectNoticeByOrg(int orgid)
        {
            return new tbPosts().SelectNoticeByOrg(orgid);
        }


    }
}